<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <title>Autocomplete Decorator</title>
    <meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
  </head>
  <body>
<table border="0" cellspacing="30">
<tr><td colspan="2"><h1 align="center">Autocomplete  Decorator</h1></td></tr>
<tr>
<td width=350" valign="top" align="justify">
<p align="center"><b><big>About project</big></b></p>
<p>This small project is 
devoted to utilities that install autocomple feature into Swing components. 
At my work I am dealing with Swing applications and 
many times there was a need in list with autocomplete feature.
Indeed, there are not a lot of free autocomplete decorators
in Internet. One of the most frequently used is 
org.jdesktop.swingx.autocomplete.AutoCompleteDecorator
 (see <a>http://www.jarvana.com/jarvana/browse/org/swinglabs/swingx</a>)
In my opinion, it is quite complicated (if you want to extend the functionality) 
and not very flexible solution of the problem. 
<br>The project is an effort to create simple and extensible utility
for installing autocomplete feature into JComboBox. There are 3 major 
utility classes:  
<ol>
  <li>AutoCompleteComboBoxDecorator: has static method decorate, that you must use to 
  install autocomplete feature to your JComboBox.</li>
  <li>AutoCompleteDocument: utility class dealing with key events</li>
  <li>BaseAutoCompleteComboBoxModel: an abstract class that describe the logic of autocompletion 
  and base functionality (for example lazy data loading). Also there are
  3 successors of BaseAutoCompleteComboBoxModel that you can see at "Examples" section.
  </li>
</ol>
I hope there will be programmers that contributes to the project:
improve my realization of decorator and add utility classes for
installing autocomplete feature into TextField. 
</p></td>
<td width="350" valign="top" align="justify">
<p align="center"><b><big>Examples of usage</big></b></p>
There is an example of decorated JComboBox when we know a full list of items to be displayed 
(idependent on text pattern typed at combobox for 
autocompletion ) and this list is not very long. Enter the positive integer numbers range in "Model" text 
field using "-" and "," symbols (example range is preentered), press "Decorate" and
play with decorated JComboBox.
<br><applet code="flinty.autocomplete.combobox.test.SimpleModelApplet" archive="simple_model_applet.jar" width="350," height="100">
        your browser does not support applets
</applet><br>
There is an example of decorated JComboBox when querying a list of appropriate items is a long-running task.
When filtering is queried
a new Thread is created. At the same time a fake dialog window with 1 * 1
pixel size is created that blocks any user action but don't block utility
background processes such as a repainting. Bad news is that this approach does
not work in the case of applets: in this demo applet querying is processed at EventDispatchThread
but still you can see text "wait..".
<br><applet code="flinty.autocomplete.combobox.test.AsyncModelApplet" archive="async_model_applet.jar" width="350," height="100">
        your browser does not support applets
</applet><br>
There is an example of decorated JComboBox when a list of items is very long and only few items are shown at popup.
<br><applet code="flinty.autocomplete.combobox.test.ShortenedModelApplet" archive="shortened_model_applet.jar" width="350," height="100">
        your browser does not support applets
</applet>
</td>
</tr>
</table>

  </body>
</html>
